package prv.pursuivant.render.html;

import java.util.Collection;

import prv.pursuivant.core.AchievTypesTree;
import prv.pursuivant.core.AchievementCalculator;
import prv.pursuivant.core.AllAchievements;
import prv.pursuivant.core.AllToons;
import prv.pursuivant.core.impl.AchievementCalculatorImpl;
import prv.pursuivant.render.DataRenderer;
import prv.pursuivant.render.Destination;
import prv.pursuivant.render.ModelRenderer;
import prv.pursuivant.render.PageContentRenderer;
import prv.pursuivant.render.PageDecorationRenderer;
import prv.pursuivant.render.TableRenderer;

import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;

public class HtmlRendererModule extends AbstractModule {

	private final Destination destination;
	private final AllToons allToons;
	private final AchievTypesTree category;
	private final AllAchievements achievements;
	private final Collection<String> activeAchievs;

	public HtmlRendererModule(Destination destination,
			Collection<String> activeAchievs, AllToons allToons,
			AchievTypesTree category, AllAchievements achievements) {
		this.destination = destination;
		this.activeAchievs = activeAchievs;
		this.allToons = allToons;
		this.category = category;
		this.achievements = achievements;
	}

	@Override
	protected void configure() {
		bind(ModelRenderer.class).to(HtmlModelRenderer.class);
		bind(TableRenderer.class).to(HtmlTableRenderer.class);
		bind(DataRenderer.class).to(HtmlDataRenderer.class);
		bind(PageContentRenderer.class).to(HtmlPageContentRenderer.class);
		bind(PageDecorationRenderer.class).to(HtmlPageDecorationRenderer.class);
		bind(AchievementCalculator.class).to(AchievementCalculatorImpl.class);
		bind(Destination.class).toInstance(destination);
		bind(AchievTypesTree.class).toInstance(category);
		bind(AllToons.class).toInstance(allToons);
		bind(AllAchievements.class).toInstance(achievements);
		TypeLiteral<Collection<String>> activeAchievsLiteral = new TypeLiteral<Collection<String>>() {
		};
		bind(activeAchievsLiteral).toInstance(activeAchievs);
	}

}
